package N2024.M11.D3;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 25228
 * Date: 2025-01-19
 * Time: 20:39
 */
public class Test1 {
    public static void main(String[] args) {
        t1 t1=new t1();
        t1.start();

        Thread t2=new Thread(new t2());
        t2.start();

        Thread t3=new Thread(){
            @Override
            public void run() {
                System.out.println("继承 Thread, 重写 run, 使用匿名内部类");
            }
        };
        t3.start();

        Thread t4=new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("实现 Runnable, 重写 run, 使用匿名内部类");
            }
        });
        t4.start();

        Thread t5=new Thread(()->{
            System.out.println("使用 lambda 表达式");
        });
        t5.start();
    }
}
class t1 extends Thread{
    @Override
    public void run() {
        System.out.println("继承 Thread, 重写 run");
    }
}

class t2 implements Runnable{

    @Override
    public void run() {
        System.out.println("实现 Runnable, 重写 run");
    }
}